package com.bjpowernode.boss.convert;

import io.netty.util.internal.StringUtil;
import org.mapstruct.Named;
import org.springframework.stereotype.Component;

@Component
public class CommonFun {

    @Named("translateStatus")
    public String translateStatus(String status) {

        if (StringUtil.isNullOrEmpty(status)) {
            return "-";
        }
        if (status.equals("ENABLE")) {
            return "启用";
        } else if (status.equals("DISABLE")) {
            return "禁用";
        }else {
            return "未知";
        }

    }

    @Named("translateAutoSet")
    public String translateAutoSet(String autoSet) {

        if (StringUtil.isNullOrEmpty(autoSet)) {
            return "-";
        }
        if (autoSet.equals("YES")) {
            return "是";
        } else if (autoSet.equals("NO")) {
            return "否";
        }else {
            return "未知";
        }

    }

}
